DicomObjects.NET.8.48 Documentation
DicomObjects Namespace / DicomImageCollection Class / Read Method / Read(Byte[],ReadBehaviours) Method
Array of Bytes to read

The behaviours to be used when reading this stream

Example

In This Topic
    Read(Byte[],ReadBehaviours) Method
    In This Topic
    Creates and adds a DicomImage from a byte array
    Syntax
    'Declaration
     
    
    Public Overloads Function Read( _
       ByVal Array() As System.Byte, _
       Optional ByVal ReadBehaviour As ReadBehaviours _
    ) As DicomImage
    public DicomImage Read( 
       System.byte[] Array,
       ReadBehaviours ReadBehaviour
    )

    Parameters

    Array
    Array of Bytes to read
    ReadBehaviour

    The behaviours to be used when reading this stream

    Return Value

    If successful, a DicomImage Object is returned, and is added to the appropriate collection. If unsuccessful, an appropriate error is thrown.
    Remarks
    This method uses memory stream to read a byte array and creates a new DicomImage and adds it to the DicomImageCollection.
    Example
    DicomImageCollection imageCollection = new DicomImageCollection();
                        
    byte[] dicomBytes = File.ReadAllBytes("your_dicom_image1.dcm");
    byte[] dicomBytes2 = File.ReadAllBytes("your_dicom_image2.dcm");
                        
     // imageCollection: [image1, image2] 
    imageCollection.Read(dicomBytes);      
    imageCollection.Read(dicomBytes2, new ReadBehaviours() { CloseFilesAfterReading = true});  // With read behaviours
    Requirements

    Target Platforms: .NET CLR 4.8 or higher

    See Also